/*     */ package com.feeyin.radar.sys.dao.impl;
/*     */ 
/*     */ import com.feeyin.radar.commons.DateUtils;
/*     */ import com.feeyin.radar.commons.StringUtils;
/*     */ import com.feeyin.radar.crm.dao.ContractBackCostDAO;
/*     */ import com.feeyin.radar.crm.dao.ContractDAO;
/*     */ import com.feeyin.radar.crm.dao.ContractDetailDAO;
/*     */ import com.feeyin.radar.crm.model.BackCost;
/*     */ import com.feeyin.radar.crm.model.Contract;
/*     */ import com.feeyin.radar.crm.model.ContractDetail;
/*     */ import com.feeyin.radar.sys.dao.BusinessTargetDAO;
/*     */ import com.feeyin.radar.sys.dao.ManageSetDAO;
/*     */ import com.feeyin.radar.sys.model.BusinessTarget;
/*     */ import com.feeyin.radar.sys.model.ManageSet;
/*     */ import java.math.BigDecimal;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Date;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import org.springframework.orm.ibatis.SqlMapClientTemplate;
/*     */ import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
/*     */ 
/*     */ public class BusinessTargetDAOImpl extends SqlMapClientDaoSupport
/*     */   implements BusinessTargetDAO
/*     */ {
/*     */   private ManageSetDAO manageSetDAO;
/*     */   private ContractDAO contractDAO;
/*     */   private ContractDetailDAO contractDetailDAO;
/*     */   private ContractBackCostDAO contractBackCostDAO;
/*     */ 
/*     */   public ManageSetDAO getManageSetDAO()
/*     */   {
/*  39 */     return this.manageSetDAO;
/*     */   }
/*     */ 
/*     */   public void setManageSetDAO(ManageSetDAO manageSetDAO) {
/*  43 */     this.manageSetDAO = manageSetDAO;
/*     */   }
/*     */ 
/*     */   public ContractDAO getContractDAO() {
/*  47 */     return this.contractDAO;
/*     */   }
/*     */ 
/*     */   public void setContractDAO(ContractDAO contractDAO) {
/*  51 */     this.contractDAO = contractDAO;
/*     */   }
/*     */ 
/*     */   public ContractDetailDAO getContractDetailDAO() {
/*  55 */     return this.contractDetailDAO;
/*     */   }
/*     */ 
/*     */   public void setContractDetailDAO(ContractDetailDAO contractDetailDAO) {
/*  59 */     this.contractDetailDAO = contractDetailDAO;
/*     */   }
/*     */ 
/*     */   public ContractBackCostDAO getContractBackCostDAO() {
/*  63 */     return this.contractBackCostDAO;
/*     */   }
/*     */ 
/*     */   public void setContractBackCostDAO(ContractBackCostDAO contractBackCostDAO) {
/*  67 */     this.contractBackCostDAO = contractBackCostDAO;
/*     */   }
/*     */ 
/*     */   public BusinessTarget getMonthTargetBySalePersonId(Integer salePersonId, String year)
/*     */   {
/*  72 */     if (salePersonId == null) return null;
/*  73 */     if (StringUtils.isEmpty(year)) return null;
/*  74 */     Map map = new HashMap();
/*  75 */     map.put("salePersonId", salePersonId);
/*  76 */     map.put("year", year);
/*  77 */     return (BusinessTarget)getSqlMapClientTemplate().queryForObject("getMonthTargetBySalePersonId", map);
/*     */   }
/*     */ 
/*     */   public BusinessTarget getCurMonthTargetBySalePersonId(Integer salePersonId) {
/*  81 */     Map map = new HashMap();
/*  82 */     map.put("salePersonId", salePersonId);
/*  83 */     map.put("year", DateUtils.getDateByFormat("yyyy"));
/*  84 */     return (BusinessTarget)getSqlMapClientTemplate().queryForObject("getMonthTargetBySalePersonId", map);
/*     */   }
/*     */ 
/*     */   public BusinessTarget getCurSeasonTargetBySalePersonId(Integer salePersonId) {
/*  88 */     Map map = new HashMap();
/*  89 */     map.put("salePersonId", salePersonId);
/*  90 */     map.put("year", DateUtils.getDateByFormat("yyyy"));
/*  91 */     return (BusinessTarget)getSqlMapClientTemplate().queryForObject("getSeasonTargetBySalePersonId", map);
/*     */   }
/*     */ 
/*     */   public BusinessTarget getCurYearTargetBySalePersonId(Integer salePersonId) {
/*  95 */     Map map = new HashMap();
/*  96 */     map.put("salePersonId", salePersonId);
/*  97 */     map.put("year", DateUtils.getDateByFormat("yyyy"));
/*  98 */     return (BusinessTarget)getSqlMapClientTemplate().queryForObject("getYearTargetBySalePersonId", map);
/*     */   }
/*     */ 
/*     */   public BigDecimal getYearTargetBySalePersonId(Integer salePersonId) {
/* 102 */     if (salePersonId == null) return new BigDecimal(0);
/* 103 */     Map map = new HashMap();
/* 104 */     map.put("salePersonId", salePersonId);
/* 105 */     map.put("year", DateUtils.getDateByFormat("yyyy"));
/* 106 */     return (BigDecimal)getSqlMapClientTemplate().queryForObject("getYearTargetByDynamic", map);
/*     */   }
/*     */ 
/*     */   public BigDecimal getYearTargetByDeptIds(String deptIds) {
/* 110 */     if (StringUtils.isEmpty(deptIds)) return new BigDecimal(0);
/* 111 */     Map map = new HashMap();
/* 112 */     map.put("deptIds", deptIds);
/* 113 */     map.put("year", DateUtils.getDateByFormat("yyyy"));
/* 114 */     return (BigDecimal)getSqlMapClientTemplate().queryForObject("getYearTargetByDynamic", map);
/*     */   }
/*     */ 
/*     */   public BigDecimal getSeasonTargetByDeptIds(String deptIds) {
/* 118 */     BigDecimal currentSeasonTarget = new BigDecimal(0);
/* 119 */     if (StringUtils.isEmpty(deptIds)) return currentSeasonTarget;
/* 120 */     Map map = new HashMap();
/* 121 */     map.put("deptIds", deptIds);
/* 122 */     map.put("year", DateUtils.getDateByFormat("yyyy"));
/* 123 */     BusinessTarget businessTarget = (BusinessTarget)getSqlMapClientTemplate().queryForObject("getSeasonTargetByDynamic", map);
/* 124 */     if (businessTarget == null) return currentSeasonTarget;
/* 125 */     int currentSeason = DateUtils.getCurrentMonthSeason(2);
/* 126 */     if (currentSeason == 1)
/* 127 */       currentSeasonTarget = businessTarget.getOneSeason();
/* 128 */     else if (currentSeason == 2)
/* 129 */       currentSeasonTarget = businessTarget.getTwoSeason();
/* 130 */     else if (currentSeason == 3)
/* 131 */       currentSeasonTarget = businessTarget.getThreeSeason();
/* 132 */     else if (currentSeason == 4) {
/* 133 */       currentSeasonTarget = businessTarget.getFourSeason();
/*     */     }
/* 135 */     return currentSeasonTarget;
/*     */   }
/*     */ 
/*     */   public BigDecimal getSeasonTargetBySalePersonId(Integer salePersonId) {
/* 139 */     BigDecimal currentSeasonTarget = new BigDecimal(0);
/* 140 */     if (salePersonId == null) return null;
/* 141 */     Map map = new HashMap();
/* 142 */     map.put("salePersonId", salePersonId);
/* 143 */     map.put("year", DateUtils.getDateByFormat("yyyy"));
/* 144 */     BusinessTarget businessTarget = (BusinessTarget)getSqlMapClientTemplate().queryForObject("getSeasonTargetByDynamic", map);
/* 145 */     if (businessTarget == null) return currentSeasonTarget;
/* 146 */     int currentSeason = DateUtils.getCurrentMonthSeason(2);
/* 147 */     if (currentSeason == 1)
/* 148 */       currentSeasonTarget = businessTarget.getOneSeason();
/* 149 */     else if (currentSeason == 2)
/* 150 */       currentSeasonTarget = businessTarget.getTwoSeason();
/* 151 */     else if (currentSeason == 3)
/* 152 */       currentSeasonTarget = businessTarget.getThreeSeason();
/* 153 */     else if (currentSeason == 4) {
/* 154 */       currentSeasonTarget = businessTarget.getFourSeason();
/*     */     }
/* 156 */     return currentSeasonTarget;
/*     */   }
/*     */ 
/*     */   public BigDecimal getPeriodTargetBySalePersonId(Integer salePersonId, Date startDate, Date endDate)
/*     */   {
/* 161 */     BigDecimal target = new BigDecimal(0);
/* 162 */     if (salePersonId == null) return target;
/* 163 */     if (startDate == null) return target;
/* 164 */     if (endDate == null) return target;
/*     */ 
/* 166 */     String startYear = DateUtils.getStringDateByFormat(startDate, "yyyy");
/* 167 */     Integer startMonth = Integer.valueOf(Integer.parseInt(DateUtils.getStringDateByFormat(startDate, "MM")));
/* 168 */     String endYear = DateUtils.getStringDateByFormat(endDate, "yyyy");
/* 169 */     Integer endMonth = Integer.valueOf(Integer.parseInt(DateUtils.getStringDateByFormat(endDate, "MM")));
/*     */ 
/* 171 */     BusinessTarget businessTarget1 = new BusinessTarget();
/* 172 */     BusinessTarget businessTarget2 = new BusinessTarget();
/* 173 */     if (startYear.equals(endYear))
/*     */     {
/* 175 */       businessTarget1 = getMonthTargetBySalePersonId(salePersonId, startYear);
/* 176 */       target = getPeriodTargetByMonthTarget(businessTarget1, startMonth.intValue(), endMonth.intValue());
/*     */     }
/*     */     else {
/* 179 */       businessTarget1 = getMonthTargetBySalePersonId(salePersonId, startYear);
/* 180 */       BigDecimal target1 = new BigDecimal(0);
/* 181 */       target1 = getPeriodTargetByMonthTarget(businessTarget1, startMonth.intValue(), 12);
/*     */ 
/* 183 */       businessTarget2 = getMonthTargetBySalePersonId(salePersonId, endYear);
/* 184 */       BigDecimal target2 = new BigDecimal(0);
/* 185 */       target2 = getPeriodTargetByMonthTarget(businessTarget2, 1, endMonth.intValue());
/*     */ 
/* 187 */       if ((target1 != null) && (target2 != null))
/* 188 */         target = target1.add(target2);
/* 189 */       else if (target1 != null)
/* 190 */         target = target1;
/* 191 */       else if (target2 != null) {
/* 192 */         target = target2;
/*     */       }
/*     */     }
/* 195 */     return target;
/*     */   }
/*     */ 
/*     */   private BigDecimal getPeriodTargetByMonthTarget(BusinessTarget businessTarget, int startMonth, int endMonth)
/*     */   {
/* 206 */     BigDecimal target = new BigDecimal(0);
/* 207 */     if (businessTarget == null) return target;
/* 208 */     if ((1 >= startMonth) && (1 <= endMonth) && 
/* 209 */       (businessTarget.getJanuaryTarget() != null)) {
/* 210 */       target = target.add(businessTarget.getJanuaryTarget());
/*     */     }
/*     */ 
/* 213 */     if ((2 >= startMonth) && (2 <= endMonth) && 
/* 214 */       (businessTarget.getFebruaryTarget() != null)) {
/* 215 */       target = target.add(businessTarget.getFebruaryTarget());
/*     */     }
/*     */ 
/* 218 */     if ((3 >= startMonth) && (3 <= endMonth) && 
/* 219 */       (businessTarget.getMarchTarget() != null)) {
/* 220 */       target = target.add(businessTarget.getMarchTarget());
/*     */     }
/*     */ 
/* 223 */     if ((4 >= startMonth) && (4 <= endMonth) && 
/* 224 */       (businessTarget.getAprilTarget() != null)) {
/* 225 */       target = target.add(businessTarget.getAprilTarget());
/*     */     }
/*     */ 
/* 228 */     if ((5 >= startMonth) && (5 <= endMonth) && 
/* 229 */       (businessTarget.getMayTarget() != null)) {
/* 230 */       target = target.add(businessTarget.getMayTarget());
/*     */     }
/*     */ 
/* 233 */     if ((6 >= startMonth) && (6 <= endMonth) && 
/* 234 */       (businessTarget.getJuneTarget() != null)) {
/* 235 */       target = target.add(businessTarget.getJuneTarget());
/*     */     }
/*     */ 
/* 238 */     if ((7 >= startMonth) && (7 <= endMonth) && 
/* 239 */       (businessTarget.getJulyTarget() != null)) {
/* 240 */       target = target.add(businessTarget.getJulyTarget());
/*     */     }
/*     */ 
/* 243 */     if ((8 >= startMonth) && (8 <= endMonth) && 
/* 244 */       (businessTarget.getAugustTarget() != null)) {
/* 245 */       target = target.add(businessTarget.getAugustTarget());
/*     */     }
/*     */ 
/* 248 */     if ((9 >= startMonth) && (9 <= endMonth) && 
/* 249 */       (businessTarget.getSeptemberTarget() != null)) {
/* 250 */       target = target.add(businessTarget.getSeptemberTarget());
/*     */     }
/*     */ 
/* 253 */     if ((10 >= startMonth) && (10 <= endMonth) && 
/* 254 */       (businessTarget.getOctoberTarget() != null)) {
/* 255 */       target = target.add(businessTarget.getOctoberTarget());
/*     */     }
/*     */ 
/* 258 */     if ((11 >= startMonth) && (11 <= endMonth) && 
/* 259 */       (businessTarget.getNovemberTarget() != null)) {
/* 260 */       target = target.add(businessTarget.getNovemberTarget());
/*     */     }
/*     */ 
/* 263 */     if ((12 >= startMonth) && (12 <= endMonth) && 
/* 264 */       (businessTarget.getDecemberTarget() != null)) {
/* 265 */       target = target.add(businessTarget.getDecemberTarget());
/*     */     }
/*     */ 
/* 269 */     return target;
/*     */   }
/*     */ 
/*     */   public BigDecimal getPeriodFinishTargetBySalePersonId(Integer salePersonId, Date startDate, Date endDate)
/*     */   {
/* 274 */     BigDecimal target = new BigDecimal(0);
/* 275 */     if (salePersonId == null) return target;
/* 276 */     if (startDate == null) return target;
/* 277 */     if (endDate == null) return target;
/*     */ 
/* 279 */     ManageSet manageSet = new ManageSet();
/* 280 */     manageSet.setMType("11");
/* 281 */     manageSet.setStatus("1");
/* 282 */     manageSet = this.manageSetDAO.getManageSetByTypeStatus(manageSet);
/* 283 */     if (manageSet == null) return target;
/*     */ 
/* 285 */     BigDecimal contractCost = new BigDecimal(0);
/* 286 */     Contract contract = new Contract();
/* 287 */     contract.setSalePersonId(salePersonId);
/* 288 */     contract.setStartDate(startDate);
/* 289 */     contract.setEndDate(endDate);
/* 290 */     contract.setMoreStatus("2,4");
/* 291 */     contractCost = this.contractDAO.getTotalContractCostByDynamic(contract);
/*     */ 
/* 293 */     String code = manageSet.getCode();
/* 294 */     String value = manageSet.getMValue();
/* 295 */     if ("isContract".equals(code)) {
/* 296 */       if (contractCost != null)
/* 297 */         target = contractCost;
/*     */     }
/* 299 */     else if ("isBackCost".equals(code)) {
/* 300 */       BackCost backCost = new BackCost();
/* 301 */       backCost.setSalePersonId(salePersonId);
/* 302 */       backCost.setStartDate(startDate);
/* 303 */       backCost.setEndDate(endDate);
/* 304 */       target = this.contractBackCostDAO.getTotalBackCostByDynamic(backCost);
/* 305 */     } else if ("isGrossProfit".equals(code)) {
/* 306 */       if ((contractCost != null) && (contractCost.compareTo(new BigDecimal(0)) > 0) && 
/* 307 */         (!StringUtils.isEmpty(value)))
/* 308 */         target = contractCost.multiply(new BigDecimal(value).divide(new BigDecimal(100)));
/*     */     }
/* 310 */     else if ("isHand".equals(code)) {
/* 311 */       List contracts = new ArrayList();
/* 312 */       contract = new Contract();
/* 313 */       contract.setSalePersonId(salePersonId);
/* 314 */       contract.setStartDate(startDate);
/* 315 */       contract.setEndDate(endDate);
/* 316 */       contract.setMoreStatus("2,4");
/* 317 */       contracts = this.contractDAO.getContractsByDynamic(contract);
/* 318 */       if ((contracts != null) || (contracts.size() <= 0)) return target;
/* 319 */       for (int i = 0; i < contracts.size(); i++) {
/* 320 */         contract = new Contract();
/* 321 */         contract = (Contract)contracts.get(i);
/* 322 */         List contractDetails = new ArrayList();
/* 323 */         contractDetails = this.contractDetailDAO.getContractDetailsByContractId(contract.getId());
/* 324 */         if ((contractDetails != null) && (contractDetails.size() > 0)) {
/* 325 */           for (int j = 0; j < contractDetails.size(); j++) {
/* 326 */             ContractDetail contractDetail = new ContractDetail();
/* 327 */             contractDetail = (ContractDetail)contractDetails.get(j);
/* 328 */             if ((contractDetail.getProssProfit() != null) && (contractDetail.getProssProfit().compareTo(new BigDecimal(0)) > 0))
/* 329 */               target = target.add(contractDetail.getProssProfit());
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/* 334 */     else if ("isGrossBackCost".equals(code)) {
/* 335 */       BackCost backCost = new BackCost();
/* 336 */       backCost.setSalePersonId(salePersonId);
/* 337 */       backCost.setStartDate(startDate);
/* 338 */       backCost.setEndDate(endDate);
/* 339 */       backCost.setGrossBackCostId(Integer.valueOf(2));
/* 340 */       backCost.setBusinessStatus("1");
/* 341 */       target = this.contractBackCostDAO.getTotalBackCostByDynamic(backCost);
/*     */     }
/* 343 */     return target;
/*     */   }
/*     */ 
/*     */   public boolean insertBusinessTarget(BusinessTarget businessTarget) {
/* 347 */     Integer result = (Integer)getSqlMapClientTemplate().insert("insertBusinessTarget", businessTarget);
/* 348 */     return result != null;
/*     */   }
/*     */ 
/*     */   public boolean deleteBusinessTargetByYear(String year)
/*     */   {
/* 353 */     Integer result = Integer.valueOf(getSqlMapClientTemplate().delete("deleteBusinessTargetByYear", year));
/* 354 */     return result != null;
/*     */   }
/*     */ 
/*     */   public BigDecimal[] getFinishedTarget(Integer currentUserId, String assignPeriod)
/*     */   {
/* 359 */     BigDecimal[] target = new BigDecimal[2];
/* 360 */     target[0] = new BigDecimal(0);
/* 361 */     target[1] = new BigDecimal(0);
/* 362 */     if (currentUserId == null) return target;
/* 363 */     if (StringUtils.isEmpty(assignPeriod)) return target;
/*     */ 
/* 365 */     ManageSet manageSet = new ManageSet();
/* 366 */     manageSet.setMType("11");
/* 367 */     manageSet.setStatus("1");
/* 368 */     manageSet = this.manageSetDAO.getManageSetByTypeStatus(manageSet);
/* 369 */     if (manageSet == null) return target;
/*     */ 
/* 371 */     Date startDate = DateUtils.getCurrentYearFirstDay();
/* 372 */     Date endDate = DateUtils.getCurrentYearEndDay();
/*     */ 
/* 374 */     if ("1".equals(assignPeriod)) {
/* 375 */       startDate = DateUtils.getCurrentMonthFirstDay();
/* 376 */       endDate = DateUtils.getCurrentMonthEndDay();
/* 377 */     } else if ("2".equals(assignPeriod)) {
/* 378 */       startDate = DateUtils.getCurrentSeasonFirstDay();
/* 379 */       endDate = DateUtils.getCurrentSeasonEndDay();
/* 380 */     } else if ("3".equals(assignPeriod)) {
/* 381 */       startDate = DateUtils.getCurrentYearFirstDay();
/* 382 */       endDate = DateUtils.getCurrentYearEndDay();
/*     */     }
/*     */ 
/* 385 */     BigDecimal contractCost = new BigDecimal(0);
/* 386 */     Contract contract = new Contract();
/* 387 */     contract.setSalePersonId(currentUserId);
/* 388 */     contract.setStartDate(startDate);
/* 389 */     contract.setEndDate(endDate);
/* 390 */     contract.setMoreStatus("2,4");
/* 391 */     contractCost = this.contractDAO.getTotalContractCostByDynamic(contract);
/*     */ 
/* 393 */     String code = manageSet.getCode();
/* 394 */     String value = manageSet.getMValue();
/* 395 */     if ("isContract".equals(code)) {
/* 396 */       if (contractCost != null)
/* 397 */         target[0] = contractCost;
/*     */     }
/* 399 */     else if ("isBackCost".equals(code)) {
/* 400 */       BackCost backCost = new BackCost();
/* 401 */       backCost.setSalePersonId(currentUserId);
/* 402 */       backCost.setStartDate(startDate);
/* 403 */       backCost.setEndDate(endDate);
/* 404 */       target[0] = this.contractBackCostDAO.getTotalBackCostByDynamic(backCost);
/* 405 */     } else if ("isGrossProfit".equals(code)) {
/* 406 */       if ((contractCost != null) && (contractCost.compareTo(new BigDecimal(0)) > 0) && 
/* 407 */         (!StringUtils.isEmpty(value)))
/* 408 */         target[0] = contractCost.multiply(new BigDecimal(value).divide(new BigDecimal(100)));
/*     */     }
/* 410 */     else if ("isHand".equals(code)) {
/* 411 */       List contracts = new ArrayList();
/* 412 */       contract = new Contract();
/* 413 */       contract.setSalePersonId(currentUserId);
/* 414 */       contract.setStartDate(startDate);
/* 415 */       contract.setEndDate(endDate);
/* 416 */       contract.setMoreStatus("2,4");
/* 417 */       contracts = this.contractDAO.getContractsByDynamic(contract);
/* 418 */       if ((contracts != null) || (contracts.size() <= 0)) return target;
/* 419 */       for (int i = 0; i < contracts.size(); i++) {
/* 420 */         contract = new Contract();
/* 421 */         contract = (Contract)contracts.get(i);
/* 422 */         List contractDetails = new ArrayList();
/* 423 */         contractDetails = this.contractDetailDAO.getContractDetailsByContractId(contract.getId());
/* 424 */         if ((contractDetails != null) && (contractDetails.size() > 0)) {
/* 425 */           for (int j = 0; j < contractDetails.size(); j++) {
/* 426 */             ContractDetail contractDetail = new ContractDetail();
/* 427 */             contractDetail = (ContractDetail)contractDetails.get(j);
/* 428 */             if ((contractDetail.getProssProfit() != null) && (contractDetail.getProssProfit().compareTo(new BigDecimal(0)) > 0))
/* 429 */               target[0] = target[0].add(contractDetail.getProssProfit());
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/* 434 */     else if ("isGrossBackCost".equals(code)) {
/* 435 */       BackCost backCost = new BackCost();
/* 436 */       backCost.setSalePersonId(currentUserId);
/* 437 */       backCost.setStartDate(startDate);
/* 438 */       backCost.setEndDate(endDate);
/* 439 */       backCost.setGrossBackCostId(Integer.valueOf(2));
/* 440 */       backCost.setBusinessStatus("1");
/* 441 */       target[0] = this.contractBackCostDAO.getTotalBackCostByDynamic(backCost);
/*     */     }
/* 443 */     if (target[0] == null) {
/* 444 */       target[0] = new BigDecimal(0);
/*     */     }
/* 446 */     if (contractCost != null) {
/* 447 */       target[1] = contractCost;
/*     */     }
/* 449 */     return target;
/*     */   }
/*     */ 
/*     */   public BigDecimal getTargetByAssignPeriod(Integer currentUserId, String assignPeriod)
/*     */   {
/* 458 */     BigDecimal target = new BigDecimal(0);
/* 459 */     if (currentUserId == null) return target;
/* 460 */     if (StringUtils.isEmpty(assignPeriod)) return target;
/*     */ 
/* 462 */     BusinessTarget businessTarget = new BusinessTarget();
/* 463 */     businessTarget = getCurMonthTargetBySalePersonId(currentUserId);
/*     */ 
/* 465 */     if (businessTarget == null) return target;
/* 466 */     if ("1".equals(assignPeriod)) {
/* 467 */       int month = 0;
/* 468 */       month = DateUtils.getCurrentMonthSeason(1);
/* 469 */       if (month == 1)
/* 470 */         target = businessTarget.getJanuaryTarget();
/* 471 */       else if (month == 2) {
/* 472 */         target = businessTarget.getFebruaryTarget();
/*     */       }
/* 474 */       else if (month == 3) {
/* 475 */         target = businessTarget.getMarchTarget();
/*     */       }
/* 477 */       else if (month == 4) {
/* 478 */         target = businessTarget.getAprilTarget();
/*     */       }
/* 480 */       else if (month == 5) {
/* 481 */         target = businessTarget.getMayTarget();
/*     */       }
/* 483 */       else if (month == 6) {
/* 484 */         target = businessTarget.getJuneTarget();
/*     */       }
/* 486 */       else if (month == 7) {
/* 487 */         target = businessTarget.getJulyTarget();
/*     */       }
/* 489 */       else if (month == 8) {
/* 490 */         target = businessTarget.getAugustTarget();
/*     */       }
/* 492 */       else if (month == 9) {
/* 493 */         target = businessTarget.getSeptemberTarget();
/*     */       }
/* 495 */       else if (month == 10) {
/* 496 */         target = businessTarget.getOctoberTarget();
/*     */       }
/* 498 */       else if (month == 11) {
/* 499 */         target = businessTarget.getNovemberTarget();
/*     */       }
/* 501 */       else if (month == 12)
/* 502 */         target = businessTarget.getDecemberTarget();
/*     */     }
/* 504 */     else if ("2".equals(assignPeriod)) {
/* 505 */       int season = 0;
/* 506 */       season = DateUtils.getCurrentMonthSeason(2);
/* 507 */       if (season == 1) {
/* 508 */         if (businessTarget.getJanuaryTarget() != null) {
/* 509 */           target = target.add(businessTarget.getJanuaryTarget());
/*     */         }
/* 511 */         if (businessTarget.getFebruaryTarget() != null) {
/* 512 */           target = target.add(businessTarget.getFebruaryTarget());
/*     */         }
/* 514 */         if (businessTarget.getMarchTarget() != null) {
/* 515 */           target = target.add(businessTarget.getMarchTarget());
/*     */         }
/*     */       }
/* 518 */       else if (season == 2) {
/* 519 */         if (businessTarget.getAprilTarget() != null) {
/* 520 */           target = target.add(businessTarget.getAprilTarget());
/*     */         }
/* 522 */         if (businessTarget.getMayTarget() != null) {
/* 523 */           target = target.add(businessTarget.getMayTarget());
/*     */         }
/* 525 */         if (businessTarget.getJuneTarget() != null) {
/* 526 */           target = target.add(businessTarget.getJuneTarget());
/*     */         }
/*     */       }
/* 529 */       else if (season == 3) {
/* 530 */         if (businessTarget.getJulyTarget() != null) {
/* 531 */           target = target.add(businessTarget.getJulyTarget());
/*     */         }
/* 533 */         if (businessTarget.getAugustTarget() != null) {
/* 534 */           target = target.add(businessTarget.getAugustTarget());
/*     */         }
/* 536 */         if (businessTarget.getSeptemberTarget() != null) {
/* 537 */           target = target.add(businessTarget.getSeptemberTarget());
/*     */         }
/*     */       }
/* 540 */       else if (season == 4) {
/* 541 */         if (businessTarget.getOctoberTarget() != null) {
/* 542 */           target = target.add(businessTarget.getOctoberTarget());
/*     */         }
/* 544 */         if (businessTarget.getNovemberTarget() != null) {
/* 545 */           target = target.add(businessTarget.getNovemberTarget());
/*     */         }
/* 547 */         if (businessTarget.getDecemberTarget() != null) {
/* 548 */           target = target.add(businessTarget.getDecemberTarget());
/*     */         }
/*     */       }
/*     */ 
/*     */     }
/*     */ 
/* 554 */     return target;
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.dao.impl.BusinessTargetDAOImpl
 * JD-Core Version:    0.6.0
 */